<?php
/**
 * Author: Administrator
 * Date: 2022/8/4 0:28
 */

namespace DesignPatterns\Behavioral\Visitor;


abstract class AbstractEntity
{
    abstract protected function EntityType();

    public function collision(VisitorInterface $visitor): void
    {
        $method = 'visit' . $this->EntityType();
        if (method_exists($visitor, $method)) {
            call_user_func([$visitor, $method], $this);
        }
    }

}